package com.yww.player

import android.os.Bundle
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.yww.player.databinding.ActivityPlayVideoBinding
import tv.danmaku.ijk.media.player.IjkMediaPlayer
import java.lang.Exception

class PlayVideoActivity : AppCompatActivity() {
    var binding: ActivityPlayVideoBinding? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        this.window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
        binding = DataBindingUtil.setContentView(this@PlayVideoActivity, R.layout.activity_play_video)
        val temp = intent
        try {
            IjkMediaPlayer.loadLibrariesOnce(null)
            IjkMediaPlayer.native_profileBegin("libijkplayer.so")
        } catch (e: Exception) {
            finish()
        }
        binding?.apply {
            val url: String = temp?.getStringExtra("url")!!
//            viewOffset.loadUrl(url)
        }
    }

    override fun onDestroy() {
        super.onDestroy()
//        binding?.viewOffset?.
    }
}